/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package combatlogparser.je;

import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.persist.EntityStore;
import com.sleepycat.persist.StoreConfig;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Administrator
 */
public class JEStore {
	public static EntityStore open(Environment env,String storeName) throws DatabaseException{
		StoreConfig storeConfig = new StoreConfig();
		storeConfig.setAllowCreate(env.getConfig().getAllowCreate());
		storeConfig.setTransactional(env.getConfig().getTransactional());        
		return new EntityStore(env, storeName, storeConfig);
	}

	public static void close(EntityStore store){
		if(store!=null){
			try {
				store.close();
			} catch (DatabaseException ex) {
				Logger.getLogger(JEStore.class.getName()).log(Level.SEVERE, null, ex);
			}
		}
	}

}
